#include <allegro.h> 
#include "fonctions.h" 
#include <stdio.h>



void destroy(objet *o)

{
o->tab_image[0]=load_bitmap("piece.bmp",NULL);
o->tab_image[1]=load_bitmap("cigar.bmp",NULL);
o->tab_image[2]=load_bitmap("blood.bmp",NULL);
o->tab_image[3]=load_bitmap("brush.bmp",NULL);

if( (mouse_b & 1) && (is_inside_bitmap(o->tab_image[0],mouse_x, mouse_y,1)!=0) )
{
destroy_bitmap(o->tab_image[0]);
}
else if ((mouse_b & 1) && (is_inside_bitmap(o->tab_image[1],mouse_x, mouse_y,1)!=0) )
{destroy_bitmap(o->tab_image[1]);}
else if((mouse_b & 1) && (is_inside_bitmap(o->tab_image[2],mouse_x, mouse_y,1)!=0) )
{destroy_bitmap(o->tab_image[2]);}
else if ( (mouse_b & 1) && (is_inside_bitmap(o->tab_image[3],mouse_x, mouse_y,1)!=0) )
{destroy_bitmap(o->tab_image[3]);}

}


void flip (carte *c, BITMAP *Background)
{

int i,pos;
char tmp[50];

for (i=0; i<25; i++)
{
sprintf(tmp,"%d.bmp",i);
c->images[i]=load_bitmap(tmp,NULL);
}

int x=mouse_x;
int y=mouse_y;
	if (mouse_b & 1);
	{
	for (i=0; i<25; i++)
	{
	if(is_inside_bitmap(c->images[i],mouse_x,mouse_y,1)!=0)
	{pos=i;}
	}
	}
draw_sprite(Background,c->images[pos+1], c->x, c->y);
}
